$(function () {

    var iAgree = $("#iAgree"),
        articleBox = $("#articleBox"),
        videoBox = $(".videoBox"),
        activeContent = $(".active-content"),
        adVideo = document.getElementById("adidas-video");
    adVideo.pause();
     iAgree.on("click", function () {
         articleBox.animate({
             "opacity":0
         }, 'fast', 'swing', function () {
             $("html, body").css("background-color","#000000");
             activeContent.remove();
             videoBox.fadeIn(300);
             $('.mask').remove();
             //背景图片消失
             $('.bg-image').hide();
         });
     });
     //监听手机横屏竖屏
     var evt = "onorientationchange" in window ? "orientationchange" : "resize";
     window.addEventListener(evt,resize,false);
     function resize(fals) {
         if(window.orientation == 0 || window.orientation == 180) {
                 // alert("竖屏");
                 $(".bg-image img").css({
                     "width":"100%"
                 });
                 $("#iAgree img").css({
                    "width":"80%"
                });
         }else {
                 // alert("横屏");
                 $(".bg-image img").css({
                     "width":"60%"
                 });
                 $("#iAgree img").css({
                    "width":"60%"
                });
         }
     }
     resize(true);

     var docEle =document.documentElement,
         evt = "onorientationchange" in window ? "orientationchange" : "resize",
         fn = function() {
             var width = docEle.clientWidth;
             width && (docEle.style.fontSize = 20 * (width / 320) + "px");
         };
     
     window.addEventListener(evt, fn, false);
     document.addEventListener("DOMContentLoaded", fn, false);
 });